<style>
    .object_image {
        filter: blur(5px);
    }
</style>

<div class="card">
	<div class="card-header">
		<h4 class="text-secondary mb-0">
            <svg height="30" width="30">
                <g class="nodes">
                    <circle cx="15" cy="15" r="15" fill="{{ meta["svg_icon"]["color"] }}"></circle>
                    <text x="15" y="15" text-anchor="middle" dominant-baseline="central" class="{{ meta["svg_icon"]["style"] }}" font-size="16px">{{ meta["svg_icon"]["icon"] }}</text>
                </g>
            </svg>
            {% if meta['name'] %}{{ meta['name'] }}{% endif %}{% if not report_mode %} :  <small><a href="{{ url_for('chats_explorer.chats_explorer_chat') }}?subtype={{ meta['subtype'] }}&id={{ meta['id'] }}">{{ meta['id'] }}</a></small>{% endif %}
        </h4>
    </div>
    <div class="card-body py-0">

        <div class="d-flex align-items-center">
            <div>
                {% if meta["tags_safe"] %}
                    {% if meta['icon'] %}
                        <span><img src="{{ url_for('objects_image.image', filename=meta['icon'])}}" class="my-1" alt="{{ meta['id'] }}" width="200" height="200"></span>
                    {% endif %}
                {% else %}
                    <span class="my-2 fa-stack fa-8x">
                        <i class="fas fa-stack-1x fa-image"></i>
                        <i class="fas fa-stack-2x fa-ban" style="color:Red"></i>
                    </span>
                {% endif %}
            </div>


            <div>
                {% if meta['username'] %}
                    <div class="mx-2">
                        <svg height="30" width="30">
                            <g class="nodes">
                                <circle cx="15" cy="15" r="15" fill="{{ meta["username"]["icon"]["color"] }}"></circle>
                                <text x="15" y="15" text-anchor="middle" dominant-baseline="central" class="{{ meta["username"]["icon"]["style"] }}" font-size="16px">{{ meta["username"]["icon"]["icon"] }}</text>
                            </g>
                        </svg>
                        {{ meta['username']['id'] }}
                    </div>
                {% endif %}


                <div class="badge badge-dark mx-2 my-1">
                    <span class="badge badge-info" style="font-size: 0.8rem;">
                        <i class="fas fa-hourglass-start"></i>
                    </span>
                    {% if meta["first_seen"] %}
                        {{meta["first_seen"][0:4]}}-{{meta["first_seen"][4:6]}}-{{meta["first_seen"][6:8]}}
                    {% endif %}
                    <span class="badge badge-light mx-1" style="font-size: 1rem;">
                        <i class="far fa-calendar-alt"></i>
                    </span>
                    {% if meta["last_seen"] %}
                        {{meta["last_seen"][0:4]}}-{{meta["last_seen"][4:6]}}-{{meta["last_seen"][6:8]}}
                    {% endif %}
                    <span class="badge badge-secondary" style="font-size: 0.8rem;">
                        <i class="fas fa-hourglass-end"></i>
                    </span>
                </div>
{#                <div class="mx-2">#}
{#                    <span class="badge badge-dark">#}
{#                        <span class="badge badge-info" style="font-size: 0.8rem;">#}
{#                            <i class="fas fa-calendar-plus"></i>#}
{#                        </span>#}
{#                        {{meta["created_at"]}}#}
{#                    </span>#}
{#                </div>#}
                <div class="mx-2">
                    <span class="badge badge-dark">
                        <span class="badge badge-info" style="font-size: 0.8rem;">
                            <i class="far fa-comments"></i> Subchannels
                        </span>
                        {{meta["nb_subchannels"]}}&nbsp;&nbsp;
                        <span class="badge badge-info" style="font-size: 0.8rem;">
                            <i class="fas fa-user-circle"></i> Participants
                        </span>
                        <a class="btn btn-secondary border-white px-1 py-0"  style="font-size: 0.8rem" href="{{ url_for('chats_explorer.chats_explorer_chat_participants')}}?type=chat&subtype={{ meta['subtype'] }}&id={{ meta['id'] }}" data-toggle="tooltip" title="Show Chat Participants">{{ meta["nb_participants"] }}&nbsp;&nbsp;</a>
                    </span>
                    {% if "nb_messages" in meta %}
                        <span class="badge badge-dark">
                            <span class="badge badge-info" style="font-size: 0.8rem;">
                                <i class="fas fa-user-circle"></i>
                                <i class="far fa-comment-dots"></i>
                            </span>
                            <a class="btn btn-primary border-white px-1 py-0"  style="font-size: 0.8rem" href="{{ url_for('chats_explorer.objects_user_account_chat') }}?subtype={{ meta['subtype'] }}&id={{ main_obj_id }}&chat_id={{ meta['id'] }}" data-toggle="tooltip" title="Show User Messages">{{ meta["nb_messages"] }}&nbsp;&nbsp;</a>
                        </span>
                    {% endif %}
                </div>
            </div>
        </div>

        {% if meta['info'] %}
            <div>
                <pre class="my-0" style="white-space: pre-wrap;">{{ meta['info'] }}</pre>
                {% if meta['translation_info'] %}
                    <hr class="m-1">
                    <pre class="my-0 text-secondary">{{ meta['translation_info'] }}</pre>
                {% endif %}
            </div>
        {% endif %}

        <div class="">
            {% for tag in meta['tags'] %}
                <span class="badge badge-{{ bootstrap_label[loop.index0 % 5] }}">{{ tag }}</span>
            {%  endfor %}
        </div>

        {% if meta['subchannels'] %}
            <table id="tablesubchannels" class="table">
                <thead class="bg-dark text-white">
                <tr>
                    <th>Name</th>
                    <th>ID</th>
                    <th>Created at</th>
                    <th>First Seen</th>
                    <th>Last Seen</th>
                    <th>
                        <i class="fas fa-user-circle"></i>
                        <i class="fas fa-comment-dots"></i>
                    </th>
                </tr>
                </thead>
                <tbody>
                {% for meta_s in meta["subchannels"] %}
                    <tr>
                        <td>
                            <b>{{ meta_s['name'] }}</b>
                            {% if meta_s['translation_name'] %}
                                <div class="text-secondary">{{ meta_s['translation_name'] }}</div>
                            {% endif %}
                        </td>
                        <td><a href="{{ url_for('chats_explorer.objects_subchannel_messages') }}?subtype={{ meta_s['subtype'] }}&id={{ meta_s['id'] }}">{{ meta_s['id'] }}</a></td>
                        <td>{{ meta_s['created_at'] }}</td>
                        <td>
                            {% if meta_s['first_seen'] %}
                                {{ meta_s['first_seen'][0:4] }}-{{ meta_s['first_seen'][4:6] }}-{{ meta_s['first_seen'][6:8] }}
                            {% endif %}
                        </td>
                        <td>
                            {% if meta_s['last_seen'] %}
                                {{ meta_s['last_seen'][0:4] }}-{{ meta_s['last_seen'][4:6] }}-{{ meta_s['last_seen'][6:8] }}
                            {% endif %}
                        </td>
                        <td>
                            {{ meta_s['nb_messages'] }}
                        </td>
                    </tr>
                {% endfor %}
                </tbody>
            </table>

        {% endif %}

	</div>
    {% if not report_mode %}
        {% include 'objects/block_object_footer_small.html' %}
    {% endif %}
</div>